<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" href="__STATIC__/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/newbase.css">
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>转到余额</title>
    <style>
        .pay_way{
            width: 100%;
            height: auto;
            background: white;
            margin-top: 5px;
        }
        .pay_way>div{
            width: 94%;
            margin: 0 auto;
            overflow: hidden;
            border-bottom: 1px solid #E9E9E9;
        }
        .pay_way>div:last-child{
            border-bottom:none;
        }
        .pay_way .title{
            float: left;
            font-size: 14px;
            line-height: 44px;
        }
        .pay_way .way{
            float: right;
            overflow: hidden;
        }
        .pay_way .way .radio + label {
            -webkit-appearance: none;
            background: url("__STATIC__/img_user/1234.png") no-repeat center left;
            background-size: 14px 14px;
            padding: 10px 7px 10px 22px;
            display: inline-block;
            font-size: 14px;
            line-height: 24px;
            font-weight: normal;
            margin-bottom: 0;
        }

        .pay_way .way .radio:checked + label {
            background: url("__STATIC__/img_user/123.png") no-repeat center left;
            background-size: 14px 14px;
        }
        .pay_way .way>div{
            float: left;
            margin-left: 10px;
        }
        .pay_way .way>div:first-child{
            margin-left: 0;
        }
        .money{
            padding: 0 0 10px 30px;
            position: relative;
        }
        .money input{
            display: block;
            font-size: 12px;
            line-height: 34px;
            text-indent: 5px;
            border: none;
            outline: none;
            color: #333;
            width: 100%;
            border-bottom: 1px solid #E9E9E9;
        }
        .money span{
            position: absolute;
            font-size: 24px;
            line-height: 34px;
            color: #333;
            left: 0;
            top:0;
        }
        .confirm{
            width: 94%;
            margin: 30px auto 0;
            font-size: 16px;
            line-height: 40px;
            background: #ddd;
            text-align: center;
            border-radius: 4px;
        }
        .confirm a{
            color: #666;
        }
        .money>div{
            overflow: hidden;
            font-size: 12px;
            line-height: 18px;
            color: #999;
            padding: 10px 0 0;
        }
        .money>div a{
            color: #0D89E1;
            float: right;
        }
    </style>
</head>
<body>
<div class="wrap-shop">

    <div class="header">
        <p>提现</p>
        <img src="/static/mobile/img/back.png" class="back" onclick="jump_back();">
    </div>

    <form id="form" method="post" action="">
        <div class="pay_way">
            <div>
                <div class="title">提现方式</div>
                <div class="way">
                    <div><input type="radio" class="radio" name="way" id="radio-1" checked value="支付宝"><label for="radio-1">支付宝</label></div>
                    <div><input type="radio" class="radio" name="way" id="radio-2" value="微信"><label for="radio-2">微信</label></div>
                </div>
            </div>
            <div>
                <div class="title">账号</div>
                <input type="text" placeholder="请输入支付宝/微信账号" name="account" datatype="*" nullmsg="账号不能为空" errormsg="账号错误" style="float: right;text-align: right;border: none;outline: none;font-size: 14px;line-height: 24px;padding: 10px 0">
            </div>
        </div>

        <div class="pay_way">
            <div>
                <div class="title" style="float: none;">提现金额</div>
                <div class="money">
                    <input type="number" name="price" placeholder="请输入金额">
                    <span>￥</span>
                    <div>可用余额[到账时间预计4-6天到账]</div>
                </div>
            </div>
        </div>
        <div class="confirm"><span id="sub">确认提现</span></div>
    </form>
</div>
<script src="__STATIC__/js/layer_mobile/layer.js"></script>
<script>
    function withdrawals() {
        var cash = $('#cash').val();
        var balance = parseFloat('{$balance}').toFixed(2);
        console.log(parseFloat(cash).toFixed(2)-balance);
        if (cash == ''){
            layer.open({content:'提现金额不能为空',skin:'msg',time:2});
            return false;
        } else if(cash < 1){
            layer.open({content:'提现金额需大于1.00元',skin:'msg',time:2});
            return false;
        }else if (cash[0] == '-' || cash[0] == '0'){
            layer.open({content:'请输入正确的金额',skin:'msg',time:2});
            return false;
        }else if ((parseFloat(cash).toFixed(2)-balance) > 0){
            layer.open({content:'佣金余额不足',skin:'msg',time:2});
            return false;
        }
        $.ajax({
            url:'',
            data:{'cash':cash},
            type:'post',
            dataType:'json',
            success:function (data) {
                layer.open({content:data.message,skin:'msg',time:2});
                setTimeout(function () {
                    window.location.reload();
                },2000)
            },
            error: function () {
                layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
            }
        })
    }
</script>
</body>
</html>